package com.netctoss.cost.dao;

import java.util.List;

import org.springframework.orm.hibernate3.HibernateTemplate;

import com.netctoss.cost.entity.Cost;
import com.netctoss.exception.DAOException;

public class SpringCostImpl implements ICostDAO {

	private HibernateTemplate hibernateTemplate;
	
	public List<Cost> findAll() throws DAOException {
		String hql = "from Cost";
		return hibernateTemplate.find(hql);
	}

	public List<Cost> findByPage(int page, int pageSize) throws DAOException {
		// TODO Auto-generated method stub
		return null;
	}

	public int findTotalPage(int pageSize) throws DAOException {
		String hql = "select count(id) from Cost";
		long totalNum = (Long) hibernateTemplate.find(hql).get(0);
		return 0;
	}

	public void delteCost(int id) throws DAOException {
		String hql = "delete from Cost where id = ?";
		hibernateTemplate.bulkUpdate(hql,id);

	}

	public Cost findByName(String name) throws DAOException {
		// TODO Auto-generated method stub
		return null;
	}

	public Cost findById(int id) throws DAOException {
		// TODO Auto-generated method stub
		return null;
	}

	public void updateCost(Cost cost) throws DAOException {
		// TODO Auto-generated method stub

	}

	public void addCost(Cost cost) throws DAOException {
		// TODO Auto-generated method stub

	}

	public void start(int id) throws DAOException {
		// TODO Auto-generated method stub

	}

	public void pause(int id) throws DAOException {
		// TODO Auto-generated method stub

	}

	public List<Cost> sortByPage(int sortStyle, int sortOrder, int page,
			int pageSize) throws DAOException {
		// TODO Auto-generated method stub
		return null;
	}

}
